<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="c.tld" prefix="c" %>
<%@ taglib uri="sql.tld" prefix="sql" %>
<jsp:useBean id="beanFaleConoscoStatus" class="classes.BeanFaleConoscoStatus" scope="request"/>
<jsp:useBean id="beanFaleConoscoPergunta" class="classes.BeanFaleConoscoPergunta" scope="request"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>

	<!-- datasource -->
	
	<c:import url="/WEB-INF/Database/dataSourceMysql.jsp"/>
	
	<!-- insert tabela faleconoscopergunta -->
	
	<sql:update>
		insert into faleconoscopergunta(idassuntofaleconosco,idlogin,pergunta,datapergunta,horapergunta)
		values(?,?,?,?,?)
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.idAssuntoFaleConosco}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.idLogin}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.pergunta}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.dataPergunta}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.horaPergunta }"/></sql:param>
	</sql:update>
	
	<!-- consulta idFaleConoscoPergunta -->
	
	<sql:query var="queryConsultaIdFaleConoscoPergunta" scope="page">
		select idfaleconoscopergunta from faleconoscopergunta 
		where idassuntofaleconosco = ? and idlogin = ? and SUBSTRING(datapergunta,1,8) = ? and SUBSTRING(horapergunta,1,6) = ?
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.idAssuntoFaleConosco}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.idLogin}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.dataPergunta}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoPergunta.horaPergunta }"/></sql:param>	
	</sql:query>
	
	<!-- set bean -->
	
	<c:forEach var="listaQueryConsultaIdFaleConoscoPergunta" items="${queryConsultaIdFaleConoscoPergunta.rows}">
		<jsp:setProperty property="idFaleConoscoPergunta" name="beanFaleConoscoPergunta" value="${listaQueryConsultaIdFaleConoscoPergunta.idfaleconoscopergunta}"/>	
	</c:forEach>
	
	<!-- insert tabela  -->
	
	<sql:update>
		insert into faleconoscostatus(idfaleconoscopergunta,statuspergunta)
		values(?,?)
	<sql:param><c:out value="${beanFaleConoscoPergunta.idFaleConoscoPergunta}"/></sql:param>
	<sql:param><c:out value="${sessionScope.beanFaleConoscoStatus.statusPergunta}"/></sql:param>
	</sql:update>
	
	<!-- envia mensagem -->
	
	<c:redirect url="Controller.jsp">
		<c:param name="redirectMensagem" value="redirect"/>
		<c:param name="mensagem"><c:out value="protocolo nr.:"/><c:out value="${beanFaleConoscoPergunta.idFaleConoscoPergunta}"/></c:param>	
	</c:redirect>
	
	
</body>
</html>